<template>
	<view class="cu-list menu sm-border solid-bottom ">
		<view class="cu-item" style="padding: 30rpx;">
			<view class="content" v-if="type=='withdrawalList'">
				<view v-if="record.incometype=='C'"
				>提现至支付宝</view>
				<view class="text-sm" v-if="record.incometype=='C'">
					<text class="text-gray" 
					>实际到账：{{record.annualpayment}} </text>
					<text class="text-gray margin-left-xs" 
					>服务费：{{record.poundage}} </text>
				</view>
				<view  v-if="record.incometype=='C'" class="text-sm text-gray" 
				>{{record.applytime}}</view>
				<view v-if="record.incometype=='R'"
				>闲本收益-《{{record.productname}}》</view>
				<view  v-if="record.incometype=='R'" class="text-sm text-gray" 
				>{{record.paymenttime}}</view>
			</view>
			<view class="content" v-if="type=='userDiamondApi'">
				<view class="margin-bottom-xs" >{{recordType[record.usetype]}}</view>
				<view class="text-gray text-sm" >{{gdate.formatTime(record.transtime)}}</view>
			</view>
			<view class="content" v-if="type=='userBeanApi'">
				<view class="margin-bottom-xs" v-if="record.transtype=='A'"
				>{{recordType[record.usetype] || '充值钻石'}}</view>
				<view class="margin-bottom-xs" v-else
				>{{recordType[record.usetype] || '消费钻石'}}</view>
				<view class="text-gray text-sm" >{{gdate.formatTime(record.transtime)}}</view>
			</view>
			<view class="action text-gray" v-if="type=='withdrawalList'">
				<view class="margin-bottom-xl " v-if="record.incometype=='C'"
				>-{{record.withdrawalamount}}</view>
				<view v-if="record.incometype=='C'">
					<text v-if="record.bankcardstatus=='S'">已到账</text>
					<text v-if="record.bankcardstatus=='N'">正在处理中</text>
				</view>
				<view class="margin-bottom text-red" v-if="record.incometype=='R'"
				>+{{record.productdiscountprice}}</view>
				<view v-if="record.incometype=='R'">收入</view>
			</view>
			<view class="action text-gray" v-if="type=='userDiamondApi'">
				<view class="margin-bottom-xs" v-if="record.transtype=='D'">{{record.diamond}}</view>
				<view class="margin-bottom-xs text-red" v-else>+{{record.diamond}}</view>
			</view>
			<view class="action text-gray" v-if="type=='userBeanApi'">
				<view class="margin-bottom-xs" v-if="record.transtype=='D'">{{record.bean}}</view>
				<view class="margin-bottom-xs text-red" v-else>+{{record.bean}}</view>
			</view>
		</view>
</view>
</template>

<script module="gdate" lang="wxs">
	function formatTime (startdate) {
		var y = 0;
		var muban = 'xxxx-xx-xx xx:xx:xx';
		var matchAry = startdate.split("");
		var regexp = getRegExp('x','g');
		return muban.replace(regexp, function(){
		    return matchAry[y++] || ''
		})
	}
	
    module.exports = {
		formatTime: formatTime
    }
</script>

<script>
import { recordType } from '@/models/enum.js';
	export default {
		name: 'RecordBank',
		data() {
			return {
				recordType: recordType
			}
		},
		computed:{
			tags() {
				let scenstyle = this.activity.scenstyle
				if (!scenstyle) return []
				return scenstyle.split(' ')
			},
			avatar() {
				let ueselist = this.activity.ueselist
				if (!ueselist) return []
				if (ueselist.length > 3) {
					ueselist = ueselist.slice(0, 3)
				} 
				return ueselist
			}
		},
		props: {
			record: {
				type: Object,
				default: () => {
					return {}
				}
			},
			type: {
				type: String,
				default: "withdrawalList"
			},
		},
		methods:{
			jumpActivity() {
				this.$jumpPages('activity', {
					gameid:	this.activity.gameid,
					gametype: this.activity.gametype,
					gameplanid:	this.activity.gameplanid,
				})
			}
		}
	}
</script>
